package com.gopay.common.domain.sensitiveInfo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import com.gopay.common.cipher.constants.EncryptType;


/**
 * Entity: 安全密钥存储
 */
@Entity
@Table(name = "SECURITY_KEYS_STORAGE")
public class SecurityKeysStorage implements java.io.Serializable  {

	/**
	 * @Fields serialVersionUID : serial版本
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 密钥的id
	 */
	private Long keyId;
	
	/**
	 * 密钥的密文
	 */
	private String keyContent;
	
	/** 
     * 创建时间
     */
    private Date createdTs;
    
    /** 
     * 销毁时间
     */
    private Date destoryTs;
    
    /** 
     * 过期时间
     */
    private Date expiryTs;
    
    /**
     * 加密方式：001：3DES加密； 其他待扩展
     */
    private EncryptType encryptType;
    //private String encryptType;
    
    /**
     * 密钥版本号
     */
    private String keyVersion;
 
    /**
     * 密钥状态：01，使用中，02，未使用，03，已过期，04，已销毁
     */
    private String status;

    /** 
     * 记录最后修改时间
     */
    private Date lastUpdTs;
    
    /** 
     * 乐观锁版本号
     */
    private Long version; 
    
    /** 
     * 备注
     */
    private String remark;
    
    /** 
     * 预留字段1
     */
    private String reserve1;
    
    /** 
     * 预留字段2
     */
    private String reserve2;
    
    /** 
     * 预留字段3
     */
    private String reserve3;
    
    

	public SecurityKeysStorage() {
	}

	@Id
	@SequenceGenerator(name = "SecurityKeySequence", sequenceName = "SECURITY_KEYS_STORAGE_SEQ")
    @GeneratedValue(generator = "SecurityKeySequence", strategy = GenerationType.SEQUENCE)
	@Column(name = "KEY_ID", unique = true, nullable = false)
	public Long getKeyId() {
		return keyId;
	}

	public void setKeyId(Long keyId) {
		this.keyId = keyId;
	}
    
	
	@Column(name = "KEY_CONTENT",  nullable = false, length = 200)
	public String getKeyContent() {
		return keyContent;
	}

	public void setKeyContent(String keyContent) {
		this.keyContent = keyContent;
	}

	@Column(name = "CREATED_TS", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatedTs() {
		return createdTs;
	}

	public void setCreatedTs(Date createdTs) {
		this.createdTs = createdTs;
	}

	@Column(name = "DESTROY_TS")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDestoryTs() {
		return destoryTs;
	}

	public void setDestoryTs(Date destoryTs) {
		this.destoryTs = destoryTs;
	}

	@Column(name = "EXPIRY_TS")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getExpiryTs() {
		return expiryTs;
	}

	public void setExpiryTs(Date expiryTs) {
		this.expiryTs = expiryTs;
	}

	@Column(name = "ENCRYPT_TYPE", length = 3, nullable = false)
    @Enumerated(EnumType.ORDINAL)
	public EncryptType getEncryptType() {
		return encryptType;
	}

	public void setEncryptType(EncryptType encryptType) {
		this.encryptType = encryptType;
	}

	@Column(name = "STATUS", length = 2, nullable = false)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "LAST_UPD_TS")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getLastUpdTs() {
		return lastUpdTs;
	}

	public void setLastUpdTs(Date lastUpdTs) {
		this.lastUpdTs = lastUpdTs;
	}

	@Version
	@Column(name = "VERSION", nullable = false)
	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "REMARK", length = 50)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "RESERVE1", length = 50)
	public String getReserve1() {
		return reserve1;
	}

	public void setReserve1(String reserve1) {
		this.reserve1 = reserve1;
	}

	@Column(name = "RESERVE2", length = 50)
	public String getReserve2() {
		return reserve2;
	}

	public void setReserve2(String reserve2) {
		this.reserve2 = reserve2;
	}

	@Column(name = "RESERVE3", length = 50)
	public String getReserve3() {
		return reserve3;
	}

	public void setReserve3(String reserve3) {
		this.reserve3 = reserve3;
	}

	@Column(name = "KEY_VERSION", length = 5, nullable = false )
	public String getKeyVersion() {
		return keyVersion;
	}

	public void setKeyVersion(String keyVersion) {
		this.keyVersion = keyVersion;
	}

    
	
}
